package com.hlx.service.impl;

import com.hlx.entiry.dto.MajorDTO;
import com.hlx.entiry.po.ConsultationAppointment;
import com.hlx.entiry.vo.MajorVO;
import com.hlx.mapper.MajorMapper;
import com.hlx.service.MajorService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@RequiredArgsConstructor
@Service
public class MajorServiceImpl implements MajorService {
	private final MajorMapper majorMapper;

	/**
	 * 查询专业信息
	 * @param majorDTO
	 * @return
	 */
	@Override
	public List<MajorVO> queryMajor(MajorDTO majorDTO) {
		List<MajorVO> list = majorMapper.selectMajor(majorDTO);
		return list;
	}

	/**
	 * 查询所有学院名称
	 * @return
	 */
	@Override
	public List<String> queryAllCollege() {
		List<String> list = majorMapper.selectAllCollege();
		return list;
	}

	/**
	 * 根据学院查询所有专业信息
	 * @param collegeName
	 * @return
	 */
	@Override
	public List<MajorVO> queryMajorByCollege(String collegeName) {
		List<MajorVO> list = majorMapper.selectByCollege(collegeName);
		return list;
	}

	/**
	 * 生成预约单
	 * @param appointment
	 */
	@Override
	public void generateAppointmentOrder(ConsultationAppointment appointment) {
		majorMapper.insertAppointment(appointment);
	}
}
